package com.leetcode.August;

/**
 * @Description: 206. 反转链表
 * @Author: Mr.Fxy
 * @CreateTime: 2024-08-23 22:38
 */
public class LC206反转链表 {
    public ListNode reverseList(ListNode head) {
        if (head == null) return null;
        ListNode cur = head, pre = null;
        while (cur != null) {
            ListNode temp = cur.next;
            cur.next = pre;
            pre = cur;
            cur = temp;
        }
        return pre;
    }
}
